package com.qd.pay.service;

import com.cdqidi.dto.ApiResult;
import com.cdqidi.dto.ApiResultWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author sjk
 */
@Service
@Slf4j
public class BillService {
    private final WxBillsService wxBillsService;

    public BillService(WxBillsService wxBillsService) {
        this.wxBillsService = wxBillsService;
    }

    public ApiResultWrapper<Object> downloadBill(String appId, String billDate, Integer type) {
        if (type == 0) {
            wxBillsService.downloadBill(billDate, appId, true);
            wxBillsService.importDb();
        }
        return ApiResult.success();
    }
}
